]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Make checking if an item is under the pointer asynchonous again
authorOwen W. Taylor <otaylor@fishsoup.net>
Fri, 4 Sep 2009 21:51:43 +0000 (17:51 -0400)
committerOwen W. Taylor <otaylor@fishsoup.net>
Fri, 4 Sep 2009 23:12:07 +0000 (19:12 -0400)
Checking if an item is under the pointer by calling stage.get_actor_at_pos()
synchronously will trigger a too-early allocation of the stage. Use an idle
at Meta.PRIORITY_BEFORE_REDRAW. (Before 553503d it was using a 5 msec timeout,
553503d made it synchronous.)

http://bugzilla.gnome.org/show_bug.cgi?id=592608

js/ui/genericDisplay.js

index 28e6b7ed51568cd1772b0c3dceece9c3f5431513..2ebdf8c59a985c4921317bf0d676eebc9a29cac4 100644 (file)
@@ -7,6 +7,7 @@ const Gdk = imports.gi.Gdk;
 const Gtk = imports.gi.Gtk;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
+const Meta = imports.gi.Meta;
 const Pango = imports.gi.Pango;
 const Signals = imports.signals;
 const Shell = imports.gi.Shell;
@@ -496,15 +497,23 @@ GenericDisplay.prototype = {
         }
 
         // Check if the pointer is over one of the items and display the information button if it is.
-        let [child, x, y, mask] = Gdk.Screen.get_default().get_root_window().get_pointer();
-        let global = Shell.Global.get();
-        let actor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y);
-        if (actor != null) {
-            let item = this._findDisplayedByActor(actor);
-            if (item != null) {
-                item.onDrawnUnderPointer();
-            }
-        }
+        // We want to do this between finishing our changes to the display and the point where
+        // the display is redrawn.
+        Mainloop.idle_add(Lang.bind(this,
+                                    function() {
+                                        let [child, x, y, mask] = Gdk.Screen.get_default().get_root_window().get_pointer();
+                                        let global = Shell.Global.get();
+                                        let actor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE,
+                                                                                  x, y);
+                                        if (actor != null) {
+                                            let item = this._findDisplayedByActor(actor);
+                                            if (item != null) {
+                                                item.onDrawnUnderPointer();
+                                            }
+                                        }
+                                        return false;
+                                    }),
+                          Meta.PRIORITY_BEFORE_REDRAW);
     },
 
     // Creates a display item based on the information associated with itemId